package net.flyinggroup.si;

import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;

import java.util.Scanner;

/**
 * @author Walker Zhang
 */
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
//        SpringApplication.run(Application.class, args);
        AbstractApplicationContext context = new AnnotationConfigApplicationContext(BasicIntegrationConfig.class);
        context.registerShutdownHook();
        Scanner scanner = new Scanner(System.in);
        System.out.print("Please enter q and press <enter> to exit the program.");

        while (true) {
            String input = scanner.nextLine();
            if ("q".equals(input.trim())) {
                context.close();
                scanner.close();
                break;
            }
        }
        System.exit(0);
    }
}